package com.yayo.mangement.service.impl;

import com.google.common.collect.Maps;
import com.yayo.mangement.dao.SysUserRoleDao;
import com.yayo.mangement.model.SysUserRoleDO;
import com.yayo.mangement.service.SysUserRoleService;
import com.yayo.mangement.paging.PageInfo;
import com.yayo.mangement.paging.Paging;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 
 * @author: Yayo
 * @date: 2020-08-07 14:18:40
 */
@Service
public class SysUserRoleServiceImpl implements SysUserRoleService{

    @Autowired
    private SysUserRoleDao sysUserRoleDao;

    @Override
    public Paging<SysUserRoleDO> paging(Integer pageNo, Integer pageSize,Map<String,Object> params){
        PageInfo pageInfo = new PageInfo(pageNo, pageSize);
        params.put("limit", pageInfo.getLimit());
        params.put("offset", pageInfo.getOffset());
        return sysUserRoleDao.paging(params);
    }

    @Override
    public SysUserRoleDO findById(Long id){
        return sysUserRoleDao.findById(id);
    }

    @Override
    public Boolean create(SysUserRoleDO sysUserRoleDO){
        return sysUserRoleDao.create(sysUserRoleDO);
    }

    @Override
    public Boolean updateById(SysUserRoleDO sysUserRoleDO){
        return sysUserRoleDao.update(sysUserRoleDO);
    }

    @Override
    public Boolean delete(Long id){
        return sysUserRoleDao.delete(id);
    }

    @Override
    public List<SysUserRoleDO> findByUserId(Long userId) {
        return sysUserRoleDao.findByUserId(userId);
    }
}